"""
部门模型
"""
from sqlalchemy import Column, String, Text, DateTime, func
from sqlalchemy.orm import relationship
from .base import Base


class Department(Base):
    """部门表"""
    __tablename__ = "departments"
    
    name = Column(String(50), nullable=False, comment="部门名称")
    description = Column(Text, comment="部门描述")
    
    # 关系
    employees = relationship("Employee", back_populates="department")
    teams = relationship("Team", back_populates="department")
    
    def __repr__(self):
        return f"<Department(id={self.id}, name='{self.name}')>"
